/*
 * @Author: your name
 * @Date: 2021-11-01 19:21:33
 * @LastEditTime: 2021-11-03 21:11:08
 * @LastEditors: Please set LastEditors
 * @Description:工具函数
 * @FilePath: \练习\snake\src\utils\index.ts
 */
export * from './ticker'

// 时间累加器
export function intervalTimer(interval: number) {
	let t = 0;
	return (n: number) => {
		t += n;
		if (t >= interval) {
			t = 0
			return true
		}
		return false
	}
}
// 生成随机数
export const randomIntegerInRange = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;